<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./template/template.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:h="http://java.sun.com/jsf/html">

    <ui:define name="content">
        <style>
            tr{
                height: 10px
            }
        </style>
        <p:panel header="#{mbUser.newUser?'Register user':'User update'}" id="userupdate">
            <h:form id="editForm">
                <table>
                    <tr>
                        <td>
                            <h:outputText value="Username:"/>
                        </td>
                        <td>
                            <p:inputText  value="#{mbUser.user.userName}" id="username" disabled="#{!mbUser.newUser}"/>
                        </td>
                    </tr>
                    <tr>
                        <td/>
                        <td>
                            <p:message for="username"/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <h:outputText value="#{mbUser.newUser?'Password':'New password:'}"/>
                        </td>
                        <td>
                            <p:inputText  type="password" value="#{mbUser.user.transPasswordNew1}" id="new1password"/>
                        </td>
                    </tr>
                    <tr>
                        <td/>
                        <td>
                            <p:message for="new1password"/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <h:outputText value="#{mbUser.newUser?'Repeat password':'Repeat new password:'}"/>
                        </td>
                        <td>
                            <p:inputText  type="password" value="#{mbUser.user.transPasswordNew2}" id="new2password"/>
                        </td>
                    </tr>
                    <tr>
                        <td/>
                        <td>
                            <p:message for="new2password"/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <h:outputText value="First name:"/>
                        </td>
                        <td>
                            <p:inputText  id="firstname" value="#{mbUser.user.firstName}"/>
                        </td>
                    </tr>
                    <tr>
                        <td/>
                        <td>
                            <p:message for="firstname"/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <h:outputText value="Last name:"/>
                        </td>
                        <td>
                            <p:inputText  id="lastname" value="#{mbUser.user.lastName}"/>
                        </td>
                    </tr>
                    <tr>
                        <td/>
                        <td>
                            <p:message for="lastname"/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <h:outputText value="JMBG::"/>
                        </td>
                        <td>
                            <p:inputMask  value="#{mbUser.user.jmbg}" id="jmbg" mask="9999999999999"/>
                        </td>
                    </tr>
                    <tr>
                        <td/>
                        <td>
                            <p:message for="jmbg"/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <p:commandButton value="Save" ajax="false" action="#{mbUser.navigationAfterUpdateUser}"/>
                            <p:commandButton value="Cancel" ajax="false" immediate="true"  action="#{mbUser.navigationToHome}"/>
                        </td>
                    </tr>
                </table>
            </h:form>
        </p:panel>
    </ui:define>

</ui:composition>
